package com.ruoyi.app.controller

import com.ruoyi.app.common.Data
import com.ruoyi.app.common.PageData
import com.ruoyi.app.domain.dto.CompleteMemberTaskDto
import com.ruoyi.app.domain.vo.*
import com.ruoyi.app.service.UserApiService
import com.ruoyi.common.core.page.PageDomain
import io.swagger.annotations.Api
import io.swagger.annotations.ApiImplicitParam
import io.swagger.annotations.ApiImplicitParams
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*

@RestController
@RequestMapping("api/user")
@Api(tags = ["用户相关api"])
class UserApiController {

    @Autowired
    private lateinit var userApiService: UserApiService

    @ApiOperation("获取app用户信息")
    @GetMapping("appUserInfo")
    fun appUserInfo(): Data<AppUserDetail?> = userApiService.appUserInfo()

    @ApiOperation("获取社友乐园数据")
    @GetMapping("clubJobData")
    fun clubJobData(): Data<List<AppClobJobVo>> = userApiService.clubJobData()

    @ApiOperation("注销账户")
    @PostMapping("logout")
    fun logout(): Data<Boolean> = userApiService.logout()

    @ApiOperation("退出账户")
    @PostMapping("exit")
    fun exit(): Data<String> = userApiService.exit()

    @ApiOperation("获取app 版本信息")
    @GetMapping("getAppVersionInfo")
    fun getAppVersionInfo(): Data<AppVersionInfoVo> = userApiService.getAppVersionInfo()

    @ApiOperation("获取ios App 版本信息")
    @GetMapping("getIosAppVersionInfo")
    fun getIosAppVersionInfo(): Data<AppVersionInfoVo> = userApiService.getIosAppVersionInfo()

    @ApiOperation("获取联系方式列表")
    @GetMapping("getContactWayList")
    fun getContactWayList(): Data<List<ContactWayVo>> = userApiService.getContactWayList()

    @ApiOperation("获取会员类型列表")
    @GetMapping("getMemberTypeList")
    fun getMemberTypeList(): Data<MemberList> = userApiService.getMemberTypeList()

    @ApiOperation("获取IOS开通会员类型列表")
    @GetMapping("getIOSMemberTypeList")
    fun getIOSMemberTypeList(): Data<List<MemberVo>> = userApiService.getIOSMemberTypeList()

    @ApiOperation("获取文案图分享信息")
    @GetMapping("getImageTextShare")
    fun getImageTextShare(): Data<ImageTextShareVo> = userApiService.getImageTextShare()

    @ApiOperation("获取链接分享信息")
    @GetMapping("getUrlShare")
    fun getUrlShare(): Data<UrlShareVo> = userApiService.getUrlShare()

    @ApiOperation("获取IOS链接分享信息")
    @GetMapping("getIosUrlShare")
    fun getIosUrlShare(): Data<UrlShareVo> = userApiService.getIosUrlShare()

    @ApiOperation("获取用户支付记录")
    @GetMapping("getPayRecordList")
    fun getPayRecordList(pageDomain: PageDomain): PageData<AppPayRecordVo> = userApiService.getPayRecordList(pageDomain)

    @ApiOperation("获取体验会员的任务类型")
    @GetMapping("getExperienceTaskType/{memberId}")
    fun getExperienceTaskType(@PathVariable memberId: Long): Data<ExperienceDetail> = userApiService.getExperienceTaskType(memberId)

    @ApiOperation("领取体验会员")
    @GetMapping("receiveMember/{memberId}")
    fun receiveMember(@PathVariable memberId: Long): Data<Boolean> = userApiService.receiveMember(memberId)

    @ApiOperation("完成会员体验任务")
    @PostMapping("completeMemberTask")
    fun completeMemberTask(completeMemberTaskDto: CompleteMemberTaskDto): Data<Boolean> = userApiService.completeMemberTask(completeMemberTaskDto)

    @ApiOperation("获取任务图片分享")
    @GetMapping("getTaskCodeShare/{taskId}")
    fun getTaskCodeShare(@PathVariable taskId: Long): Data<AppTaskCodeShareVo> = userApiService.getTaskCodeShare(taskId)

    @ApiOperation("获取任务链接分享")
    @GetMapping("getTaskShare/{taskId}")
    fun getTaskShare(@PathVariable taskId: Long): Data<AppTaskShareVo> = userApiService.getTaskShare(taskId)

    @ApiOperation("增加曝光点击次数")
    @PostMapping("addClubJobDataCount")
    @ApiImplicitParams(
        ApiImplicitParam(name = "type", value = "1. 曝光 2.点击", required = true),
        ApiImplicitParam(name = "clubJobId", value = "乐园id", required = true)
    )
    fun addClubJobDataCount(type: Int, clubJobId: Long): Data<Boolean> = userApiService.addClubJobDataCount(type, clubJobId)

}